import time
import threading
from functools import partial

def timeToMidnight():
    localTime = time.localtime()
    return int(time.mktime(localTime[:2] + (localTime[2] + 1, 0, 0, 0, 0, 0, 0)) - time.mktime(localTime))

def timeToAfternoon():
    localTime = time.localtime()
    if localTime[3] >=12:
        return int(time.mktime(localTime[:2] +(localTime[2] + 1, 12, 0, 0, 0, 0, 0)) - time.mktime(localTime))
    else:
        return int(time.mktime(localTime[:3] + (12, 0, 0, 0, 0, 0)) - time.mktime(localTime))